package com.itwang.framework.common.validator;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class PhoneNumberValidator implements ConstraintValidator<PhoneNumber, String> {

    public void initialize(PhoneNumber constraintAnnotation){
        // todo 这里进行一些初始化操作
    }
    @Override
    public boolean isValid(String phoneNumber, ConstraintValidatorContext context) {
        return phoneNumber!=null&& phoneNumber.matches("\\d{11}");
    }
}
